{% extends "blogs/admin/base_blog.html" %}

{% block current_action %}Manage comments{% endblock %}

{% block content %}
    <p>You can <a href="{% url blogs.admin.link_add blog_slug %}">add new links</a> to sites you visit often and share them on your blog.</p>
    {% if links %}
        <p>Here are the links for this blog.</p>
        <form action="delete/" method="post">
            <table>
                <thead>
                    <tr>
                        <th><input id="select-all" type="checkbox" onclick="selectAll();"/></th>
                        <th>Name</th>
                        <th>URL</th>
                        <th>Tooltip</th>
                        <th>Active</th>
                        <th colspan="2">Action</th>
                    </tr>
                </thead>
                <tbody>
                    {% for link in links %}
                        <tr>
                            <td><input type="checkbox" name="selected_link" value="{{ link.id }}" /></td>
                            <td>{{ link.name }}</td>
                            <td>{{ link.url }}</td>
                            <td>{{ link.tooltip }}</td>
                            <td>{{ link.active|yesno }}</td>
                            <td><a href="{% url blogs.admin.link_edit blog_slug,link.id %}" title="Edit link"><img src="{{ ADMIN_MEDIA_PREFIX }}img/admin/icon_changelink.gif" alt="edit" /></a></td>
                            <td><a href="{% url blogs.admin.link_delete blog_slug,link.id %}" title="Delete link"><img src="{{ ADMIN_MEDIA_PREFIX }}img/admin/icon_deletelink.gif" alt="delete" /></a></td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table><br />
            <input type="submit" value="Delete Selected" />
        </form>
    {% else %}

        <p>There are no links to manage for this blog.</p>
    
    {% endif %}
    
    <script type="text/javascript">
    function selectAll() {
        if ($("#select-all")[0].checked) {
            $("input[name=selected_link]").attr("checked", true);
        } else {
            $("input[name=selected_link]").attr("checked", false);
        }
    }
    </script>

{% endblock %}
